<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>更换标题</title>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }
        .ttop {
            width: 100%;
            height: 50px;
            line-height: 50px;
            border-bottom: 1px solid #999;
            position: relative;
        }
        .back {
            position: absolute;
            top: 1px;
            right: 10px;
            color: #666;
            font-size: 16px;
        }

        .ttop div{
             text-align: center;    
             font-size: 20px;        
        }
    </style>
</head>
<body>
    <div id="app">
        <nav-top>
            <span>我的页面</span>
        </nav-top>
    </div>
    <template id="top">
        <div class="ttop">
            <div>
                <slot>首页</slot>
            </div>
            <span class="back">返回</span>
        </div>
    </template>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script type="text/javascript">
        var vm = new Vue({
            el: "#app",
            data: {
    
            },
            components: {
                "nav-top": {
                    template: "#top"
                }
            }
    
        });
    </script>
</body>
</html>
